export default defineNuxtConfig({
  modules: [
    '@vueuse/nuxt',
    '@unocss/nuxt',
    '@pinia/nuxt',
    'nuxt-module-eslint-config',
    '@nuxtjs/i18n',
    'nuxt-swiper',
    '@element-plus/nuxt',
    'nuxt-aos',
  ],
  elementPlus: { /** Options */ },
  experimental: {
    // when using generate, payload js assets included in sw precache manifest
    // but missing on offline, disabling extraction it until fixed
    payloadExtraction: false,
    renderJsonPayloads: true,
    typedPages: true,
  },

  css: [
    '@unocss/reset/tailwind.css',
    'animate.css/animate.min.css',
    '~/assets/css/main.css',
  ],

  nitro: {
    esbuild: {
      options: {
        target: 'esnext',
      },
    },
    prerender: {
      crawlLinks: false,
      routes: ['/'],
      // ignore: ['/hi'],
    },
  },

  app: {
    head: {
      title: `超益钢业`,

      link: [
        { rel: 'icon', href: '/favicon.ico' },
      ],
      viewport: 'width=device-width,initial-scale=1',
      meta: [
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
        // { name: 'theme-color', media: '(prefers-color-scheme: light)', content: 'white' },
        // { name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#222222' },
        { hid: 'description', name: 'description', content: '福建超益钢业有限公司' },
        { hid: 'keywords', name: 'keywords', content: '福建超益钢业有限公司' },
      ],
      script: [{
        type: 'text/javascript',
        src: 'https://webapi.amap.com/maps?v=2.0&key=448c334ca05e5ef7ff22cc1c33cb133d',
      }],
    },
  },

  devtools: {
    enabled: true,
  },

  features: {
    // For UnoCSS
    inlineStyles: false,
  },

  eslintConfig: {
    setup: false,
  },

  i18n: {
    locales: [
      {
        code: 'en',
        name: 'English',
        file: 'en.json',
      },
      {
        code: 'zh',
        name: 'Chinese',
        file: 'zh-CN.json',
      },
    ],
    langDir: './locales',
    strategy: 'no_prefix',
    defaultLocale: 'zh',
    // vueI18n: './i18n.config.ts',
  },
  postcss: {
    plugins: {
      'postcss-nested': {},
      'postcss-mobile-forever': {
        viewportWidth: 1920,
        mediaQuery: true,
        exclude: /node_modules/,
        maxDisplayWidth: 1920,
        experimental: {
          minDisplayWidth: 1440,
        },
      },
    },
  },

  aos: {
    duration: 1000,
  },
})
